<template>
<div>
    <h1>App根组件</h1>
    <hr>
    <button class="btn btn-secondary" @click="flag=!flag">Toggle</button>
    <!-- 以标签形式使用组件 -->
    <LifeCycle v-if="flag"></LifeCycle>
</div>
</template>

<script>
// import导入组件
import LifeCycle from "./LifeCycle.vue";
export default{
    name:'MyApp',
    data(){
        return{
            flag:true,
        }
    },
    // components注册组件
    components:{
        LifeCycle,
    }
}
</script>

<style lang="less" scoped></style>